package com.michael.demos.springboot.mybatisplus.customizedId.config;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;
import com.michael.demos.springboot.mybatisplus.customizedId.core.IdMaker;
import com.michael.demos.springboot.mybatisplus.customizedId.util.NumUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * ID 生成器 Bean 配置
 */
@Configuration
public class IdGeneratorConfig {

    @Bean(name = "userId")
    public IdMaker userId() {
        return NumUtil.initIdMaker(1, 1, true);
    }

    @Bean(name = "appleId")
    public Snowflake appleId() {
        return IdUtil.getSnowflake(1, 1);
    }
}
